﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class pages_Enrol_MaterialID : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
    {
        DataSet ds = DB.reDs("select * from tb_Material where WzType='" + this.TreeView1.SelectedNode.Value.ToString() + "'");
        this.gvStatistic.DataSource = ds;
        this.gvStatistic.DataKeyNames = new string[] { "WzID" };
        this.gvStatistic.DataBind();
    }
    protected void gvStatistic_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        //this.Panel1.Visible = false;
        string id = this.gvStatistic.DataKeys[e.NewSelectedIndex].Value.ToString();//取得主键值
        DataSet ds = DB.reDs("select * from tb_Material where WzID='" + id + "'");//返回根据主键值从数据库中筛选到记录
        string WzID= ds.Tables[0].Rows[0][0].ToString();//绑定到控件上显示出来
        string Name= ds.Tables[0].Rows[0][2].ToString();
        string Model = ds.Tables[0].Rows[0][3].ToString();
        string Spec = ds.Tables[0].Rows[0][4].ToString();
        string Card= ds.Tables[0].Rows[0][5].ToString();
        string UnitPrise = ds.Tables[0].Rows[0][6].ToString();
        string returnvalue = WzID + "," + Name + "," + Model + "," + Spec + "," + Card + "," + UnitPrise;
        Session["returnValue"] = returnvalue;
        string []aa=returnvalue.Split(new Char[] {','});
        foreach (string a in aa)
        {
            Response.Write(a+"<br>");
        }
        Response.Write("<script>window.returnValue='"+returnvalue+"';window.close();</script>");
    }
}
